(function(app){
	app.action(['/myQuery/:num'], 'myQuery/page.html', ['$scope', '$route', '_API', '$location', '$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			
			var num = $route.current.params.num;
			var path = "/query";
			function reload(){
				_API.ajax('person/contact/list',{})
				.success(function(json){
					$scope.data = json.result;
					$scope.num = num;
				})
				.error(function(json){
					if(json.code == 201){
						$location.path('/certification');
						alert("请登陆手机端，完成实名认证！");
					}
				});
			}
			reload();
			$scope.save = function() {
				var $subBox = $("input[name='radioBox']");
				var ids = "";
				var insured = "";
				for (var i=0; i<$subBox.length; i++) {
					var box = $subBox[i];
					if(box.checked){
						ids = box.value;
					}
				}
				if(ids == "") {
					alert("请选择要查询的用户。");
					return;
				}
				$location.path(path+num+"/"+ids);
			}
			
		}
	]);
	
	app.action(['/query0/:ids'], 'myQuery/query0.html', ['$scope', '$route', '_API', '$location', 	'$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			var CA001 = $route.current.params.ids;
			function query(CA001){
				_API.ajax('homePage/myTransfer/getInfoByCa001',{"CA001":CA001})
				.success(function(json){
					$scope.user = json.result;
					$scope.path = location.pathname + "#/query8/"+json.result.CA001;
					// $scope.path = "/#/query8/"+json.result.CA001;
				});
			}
			query(CA001);
			function query0(CA001){
				_API.ajax('homePage/query/insureInfo',{"CA001":CA001})
				.success(function(json){
					if(json.isPass == true){
						$scope.data = json.result;
					} else {
						alert("无此人参保登记信息");
					}
				});
			}
			query0(CA001);
			
		}
	]);
	
	app.action(['/query8/:ids'], 'myQuery/query8.html', ['$scope', '$route', '_API', '$location','$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			var CA001 = $route.current.params.ids;
			function query(CA001){
				_API.ajax('homePage/myTransfer/getInfoByCa001',{"CA001":CA001})
				.success(function(json){
					$scope.user = json.result;
				});
			}
			query(CA001);
			function query8(CA001){
				_API.ajax('homePage/myQuery/query1',{"CA001":CA001,"insured":2})
				.success(function(json){
					$scope.data = json.result;
				});
			}
			query8(CA001);
		}
	]);
	
	app.action(['/query1/:ids'], 'myQuery/query1.html', ['$scope', '$route', '_API', '$location','$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			var CA001 = $route.current.params.ids;
			function query(CA001){
				_API.ajax('homePage/myTransfer/getInfoByCa001',{"CA001":CA001})
				.success(function(json){
					$scope.user = json.result;
				});
			}
			query(CA001);
			function query1(CA001){
				_API.ajax('homePage/myQuery/query1',{"CA001":CA001,"insured":1})
				.success(function(json){
					$scope.data = json.result;
				});
			}
			query1(CA001);
		}
	]);
	
	app.action(['/query2/:ids'], 'myQuery/query2.html', ['$scope', '$route', '_API', '$location', 	'$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			var CA001 = $route.current.params.ids;
			function query(CA001){
				_API.ajax('homePage/myTransfer/getInfoByCa001',{"CA001":CA001})
				.success(function(json){
					$scope.user = json.result;
					$scope.path = location.pathname + "#/query7/"+json.result.CA001;
				});
			}
			query(CA001);
			function query2(CA001){
				_API.ajax('homePage/myQuery/query2',{"CA001":CA001})
				.success(function(json){
					$scope.data = json.result;
				});
			}
			query2(CA001);
		}
	]);
	
	app.action(['/query7/:ids'], 'myQuery/query7.html', ['$scope', '$route', '_API', '$location','$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			var CA001 = $route.current.params.ids;
			function query(CA001){
				_API.ajax('homePage/myTransfer/getInfoByCa001',{"CA001":CA001})
				.success(function(json){
					$scope.user = json.result;
				});
			}
			query(CA001);
			function query8(CA001){
				_API.ajax('homePage/myReceivePay/payDetail',{"CA001":CA001})
				.success(function(json){
					$scope.data = json.result;
				});
			}
			query8(CA001);
		}
	]);
	
	app.action(['/query3/:ids'], 'myQuery/query3.html', ['$scope', '$route', '_API', '$location', 	'$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			var CA001 = $route.current.params.ids;
			function query(CA001){
				_API.ajax('homePage/myTransfer/getInfoByCa001',{"CA001":CA001})
				.success(function(json){
					$scope.user = json.result;
				});
			}
			query(CA001);
			function query3(CA001){
				_API.ajax('homePage/myQuery/query3',{"CA001":CA001})
				.success(function(json){
					$scope.data = json.result;
				});
			}
			query3(CA001);
		}
	]);
	
	app.action(['/query4/:ids'], 'myQuery/query4.html', ['$scope', '$route', '_API', '$location', 	'$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			var CA001 = $route.current.params.ids;
			function query(CA001){
				_API.ajax('homePage/myTransfer/getInfoByCa001',{"CA001":CA001})
				.success(function(json){
					$scope.user = json.result;
				});
			}
			query(CA001);
			function query4(CA001){
				_API.ajax('homePage/myQuery/query4',{"CA001":CA001})
				.success(function(json){
					$scope.data = json.result;
				});
			}
			query4(CA001);
		}
	]);
	
	app.action(['/query5/:ids'], 'myQuery/query5.html', ['$scope', '$route', '_API', '$location', 	'$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			var CA001 = $route.current.params.ids;
			function query(CA001){
				_API.ajax('homePage/myTransfer/getInfoByCa001',{"CA001":CA001})
				.success(function(json){
					$scope.user = json.result;
				});
			}
			query(CA001);
			function query5(CA001){
				_API.ajax('homePage/myQuery/query5',{"CA001":CA001})
				.success(function(json){
					$scope.data = json.result;
				});
			}
			query5(CA001);
		}
	]);
	
	app.action(['/query6/:ids'], 'myQuery/query6.html', ['$scope', '$route', '_API', '$location', 	'$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {
			var CA001 = $route.current.params.ids;
			function query(CA001){
				_API.ajax('homePage/myTransfer/getInfoByCa001',{"CA001":CA001})
				.success(function(json){
					$scope.user = json.result;
				});
			}
			query(CA001);
			function query6(CA001){
				_API.ajax('homePage/myQuery/query6',{"CA001":CA001})
				.success(function(json){
					$scope.data = json.result;
				});
			}
			query6(CA001);
		}
	]);
})($SDC.app);